# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: Tim Meusel <tim@bastelfreak.de>

_gemname='nats-pure'
pkgname="ruby-${_gemname}"
pkgver=2.3.0
pkgrel=1
pkgdesc="Ruby client for the NATS messaging system"
url="https://github.com/nats-io/nats-pure.rb"
arch=('any')
license=('MIT')
depends=('ruby')
makedepends=('ruby-rake' 'ruby-rspec' 'ruby-bundler' 'ruby-rdoc' 'ruby-test-unit')
options=('!emptydirs')
source=("${_gemname}-v${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha512sums=('e87d67ad6a52adc92d7cb36e20f02eb9600b13b61939c4cf104e685076e2c18943d0ed614d8a3f181fc86806c57681b27b30a2d6ec243ff655448ee7af2ef9c1')


prepare() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  :
}

build() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  mkdir -p pkg
  gem build -o "pkg/${_gemname}-${pkgver}.gem"
}

check() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  # testsuite requires a running nats server to test against
  #rake spec
}

package() {
  cd "${srcdir}/${_gemname}.rb-${pkgver}"
  local _gemdir="$(gem env gemdir)"

  gem install \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "${pkgdir}/${_gemdir}" \
    --bindir "${pkgdir}/usr/bin" \
    "pkg/${_gemname}-${pkgver}.gem"

  rm -rf "${pkgdir}/${_gemdir}/cache"

  install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim: ts=2 sw=2 et:
